import { ref, onMounted, onUnmounted } from "vue";

import { storeToRefs } from 'pinia'
import { useIsCollapseStore } from "@/stores/iscollapse";

export function useResize() {
    let { isCollapse } = storeToRefs(useIsCollapseStore());
    let { changeWidth } = useIsCollapseStore();
    onMounted(() => {
        window.onresize = function () {
            if (innerWidth >= 800) {
                isCollapse.value = false;
                changeWidth(innerWidth-100);

            } else {
                isCollapse.value = true;
                changeWidth(400);


            }
        };
    });
    onUnmounted(() => {
        window.onresize = null;
    })

    // return {
    //     w,
    // }
}
